<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //结论 变量声明使用 let 常量声明使用 const


        //1 let声明的变量有自己的作用域
        {
            var a = 12
            let b = 13
            console.log(b)

        }
        console.log(a)
        // console.log(b)

        //var声明的变量可以被修改值，let不行
        var c = 12
        console.log(c)
        var c = 16
        console.log(c)

        let d = 32
        // let d = 333

        //3 const 声明的变量不能修改值
        //Uncaught TypeError: Assignment to constant variable.
        const e = 'aaaa'
        console.log(e)
        // e = 'bbbb'
        // e = e + "cccc"
        console.log(e)
    </script>

</body>

</html>